package com.abk.ets.data;

// Generated 26 avr. 2013 10:28:47 by Hibernate Tools 3.4.0.CR1

import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

/**
 * Investisseur generated by hbm2java
 */
@Entity
@Table(name = "investisseur", catalog = "etsdatabase")
public class Investisseur implements java.io.Serializable {

	private int idInvestisseur;
	private Personne personne;
	private int etat;
	private Set offres = new HashSet(0);
	private Set transactions = new HashSet(0);

	public Investisseur() {
	}

	public Investisseur(Personne personne, int etat) {
		this.personne = personne;
		this.etat = etat;
	}

	public Investisseur(Personne personne, int etat, Set offres,
			Set transactions) {
		this.personne = personne;
		this.etat = etat;
		this.offres = offres;
		this.transactions = transactions;
	}

	@GenericGenerator(name = "invId", strategy = "foreign", parameters = @Parameter(name = "property", value = "personne"))
	@Id
	@GeneratedValue(generator = "invId")
	@Column(name = "idInvestisseur", unique = true, nullable = false)
	public int getIdInvestisseur() {
		return this.idInvestisseur;
	}

	public void setIdInvestisseur(int idInvestisseur) {
		this.idInvestisseur = idInvestisseur;
	}

	@OneToOne(fetch = FetchType.LAZY)
	@PrimaryKeyJoinColumn
	public Personne getPersonne() {
		return this.personne;
	}

	public void setPersonne(Personne personne) {
		this.personne = personne;
	}

	@Column(name = "etat", nullable = false)
	public int getEtat() {
		return this.etat;
	}

	public void setEtat(int etat) {
		this.etat = etat;
	}

	@OneToMany(fetch = FetchType.EAGER,targetEntity=Offre.class, mappedBy="investisseur")
	public Set getOffres() {
		return this.offres;
	}

	public void setOffres(Set offres) {
		this.offres = offres;
	}

	@OneToMany(fetch = FetchType.EAGER, targetEntity=Transaction.class, mappedBy="investisseur")
	public Set getTransactions() {
		return this.transactions;
	}

	public void setTransactions(Set transactions) {
		this.transactions = transactions;
	}

}
